import yt_dlp
import logging

async def extract_tiktok_video(url: str, timeout_seconds=120) -> str:
    ydl_opts = {
        'quiet': True,
        'skip_download': True,
        'force_generic_extractor': False,
    }
    logging.info("---提取视频---")
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        info = ydl.extract_info(url, download=False)
        video_url = info.get("url")
        logging.info(f"🔍 yt_dlp 提取：{video_url}")
        return video_url
